package com.example.libpro.MyActivity.adminActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.libpro.MyActivity.LoginActivity;
import com.example.libpro.R;

public class AdminMainActivity extends AppCompatActivity implements View.OnClickListener{
    private Button btnAddBook;
    private Button btnSearchBook;
    private Button btnAddReader;
    private Button btnSearchReader;
    private Button btnSearchBorrow;
    private Button btnLogout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_main);

        btnAddBook=findViewById(R.id.btnAddBook);
        btnSearchBook=findViewById(R.id.btnSearchBook);
        btnAddReader=findViewById(R.id.btnAddReader);
        btnSearchReader=findViewById(R.id.btnSearchReader);
        btnSearchBorrow=findViewById(R.id.btnSearchBorrow);
        btnLogout=findViewById(R.id.btnLogout);

        btnAddBook.setOnClickListener(this);
        btnSearchBook.setOnClickListener(this);
        btnAddReader.setOnClickListener(this);
        btnSearchReader.setOnClickListener(this);
        btnSearchBorrow.setOnClickListener(this);
        btnLogout.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.btnAddBook) {
            startActivity(new Intent(this, AdminAddBookActivity.class));
        } else if (id == R.id.btnSearchBook) {
            startActivity(new Intent(this, AdminSearchBookActivity.class));
        } else if (id == R.id.btnAddReader) {
            startActivity(new Intent(this, AdminAddReaderActivity.class));
        } else if (id == R.id.btnSearchReader) {
            startActivity(new Intent(this, AdminSearchUserActivity.class));
        } else if (id == R.id.btnSearchBorrow) {
            startActivity(new Intent(this, AdminBorrowStatusActivity.class));
        } else if (id == R.id.btnLogout) {
            startActivity(new Intent(this, LoginActivity.class));
            finish();
        }

    }
}